# flake8: noqa
from vnpy.event import EventEngine
from vnpy.trader.engine import MainEngine
from vnpy.trader.ui import MainWindow, create_qapp
from vnpy_ctp import CtpGateway
# from vnpy_uft import UftGateway
from vnpy.app.ctastrategy import CtaStrategyApp
from vnpy.app.ctabacktester import CtaBacktesterApp

# from vnpy.app.spreadtrading import SpreadTradingApp
# from vnpy.app.algotrading import AlgoTradingApp
# from vnpy.app.optionmaster import OptionMasterApp
# from vnpy.app.portfoliostrategy import PortfolioStrategyApp
# from vnpy.app.scripttrader import ScriptTraderApp
# from vnpy.app.chartwizard import ChartWizardApp
# from vnpy.app.rpcservice import RpcServiceApp
# from vnpy.app.excelrtd import ExcelRtdApp
from vnpy.app.datamanager import DataManagerApp
from vnpy.app.datarecorder import DataRecorderApp
# from vnpy.app.riskmanager import RiskManagerApp
# from vnpy.app.webtrader import WebTraderApp
# from vnpy.app.portfoliomanager import PortfolioManagerApp
# from vnpy.app.paperaccount import PaperAccountApp


def main():
    """"""
    qapp = create_qapp()

    event_engine = EventEngine()

    main_engine = MainEngine(event_engine)
    main_engine.add_gateway(CtpGateway)
    # main_engine.add_gateway(UftGateway)
    # main_engine.add_app(PaperAccountApp)
    # main_engine.add_app(CtaStrategyApp)
    main_engine.add_app(CtaBacktesterApp)
    # main_engine.add_app(SpreadTradingApp)
    # main_engine.add_app(AlgoTradingApp)
    # main_engine.add_app(OptionMasterApp)
    # main_engine.add_app(PortfolioStrategyApp)
    # main_engine.add_app(ScriptTraderApp)
    # main_engine.add_app(ChartWizardApp)q
    # main_engine.add_app(RpcServiceApp)
    # main_engine.add_app(ExcelRtdApp)
    main_engine.add_app(DataManagerApp)
    main_engine.add_app(DataRecorderApp)
    # main_engine.add_app(RiskManagerApp)ins
    # main_engine.add_app(WebTraderApp)
    # main_engine.add_app(PortfolioManagerApp)
    
    main_window = MainWindow(main_engine, event_engine)
    main_window.showMaximized()

    qapp.exec()


if __name__ == "__main__":
    main()
